#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int minSubArrayLen(int target, int* nums, int numsSize)
{
    int result = numsSize + 1;
    int i = 0;
    int j = 0;
    int sum = 0;
    for (; j < numsSize; j++)
    {
        sum += nums[j];
        while (sum >= target)
        {
            int length = j - i + 1;
            if (result > length)
            {
                result = length;
            }
            sum -= nums[i];
            i++;
        }
    }
    if (result == numsSize + 1)
        return 0;
    return result;
}

int** generateMatrix(int n, int* returnSize, int** returnColumnSizes)
{
    int** ans = (int**)malloc(sizeof(int*) * n);
    *returnSize = n;
    *returnColumnSizes = malloc(sizeof(int) * n);
    for (int i = 0; i < n; i++)
    {
        (*returnColumnSizes)[i] = n;
        ans[i] = (int*)malloc(sizeof(int) * n);
        memset(ans[i], 0, sizeof(int) * n);
    }
    int i = 0; int j = 0; int k = 1;
    for (int a = 0; a < n / 2; a++)
    {
        for (j = a; j < n - a - 1; j++)
        {
            ans[a][j] = k++;
        }
        for (i = a; i < n - a - 1; i++)
        {
            ans[i][j] = k++;
        }
        for (; j > a; j--)
        {
            ans[i][j] = k++;
        }
        for (; i > a; i--)
        {
            ans[i][j] = k++;
        }
    }
    if (n % 2 != 0)
    {
        ans[n / 2][n / 2] = k;
    }
    return ans;
}